package net.springmvc19_20.controller;

import net.springmvc19_20.entity.Stu;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("stu")
public class UserRestFulController {

    // 查询详情
    @GetMapping("/{id}")
    public String getUserById(@PathVariable int id) {
        return "getUserById";
    }
    //查询所有
    @GetMapping
    public String getUser(@RequestParam int pageNo,
                          @RequestParam int pageSize) {
        System.out.println(pageNo);
        System.out.println(pageSize);
        return "getUserList";
    }
    // 添加
    @PostMapping
    public String postUser(@RequestBody Stu user) {
        System.out.println(user);
        return "postUser";
    }

    // 修改
    @PutMapping
    public String putUser(@RequestBody Stu user) {
        System.out.println(user);
        return "putUser";
    }

    // 删除
    @DeleteMapping("/{id}")
    public String deleteUser(@PathVariable int id) {
        System.out.println(id);
        return "deleteUser";
    }
}
